<template>
  <div class="gd-rank">
    <i-dialog
      :visible="visible"
      :title="title"
      width="600px"
      top="10%"
      :modal-append-to-body="false"
      @close="outerClose"
    >
      <div class="warpper">
        <p class="title">
          <span>排名</span>
          <span>城市名/电站名</span>
          <span>数量</span>
        </p>
        <p v-for="(item, index) in data" :key="index" class="item">
          <span>{{ index + 1 }}</span>
          <span>{{ item.name }}</span>
          <span>{{ item.val }}</span>
        </p>
      </div>
    </i-dialog>
  </div>
</template>
<script>
export default {
  name: 'GdRankDialog',
  data() {
    return {
      list: [],
    }
  },
  props: {
    visible: {
      type: Boolean,
      required: true,
    },
    data: {
      type: Array,
      require: true,
    },
    title: {
      type: String,
      require: true,
    },
  },
  methods: {
    outerClose() {
      this.$emit('update:visible', false)
    },
  },
}
</script>
<style lang="scss" scoped>
.gd-rank {
  &::v-deep .el-dialog {
    background: rgba(0, 166, 243, 0.5);
    // background: url(../../../assets/images/exhibition/gd-rank-bg.png) center
    //   center no-repeat;
    // background-size: 100% 100%;
    .el-dialog__header {
      background: rgba(0, 166, 243, 0.5);
      border-bottom: none;
      border-radius: 0;
    }
    .el-dialog__body {
      padding: 0 4px;
      .el-table__header-wrapper {
        background: rgba(0, 166, 243, 0.5);
      }
    }
  }
  .warpper {
    height: 400px;
    overflow: auto;
    &::-webkit-scrollbar {
      width: 4px;
      background: rgba(0, 166, 243, 0.2);
    }
    &::-webkit-scrollbar-thumb {
      border-radius: 2px;
      background: #6be1fb;
    }
    p {
      display: flex;
      justify-content: space-around;
      color: #fff;
      font-size: 12px;
      span:nth-child(1) {
        width: 120px;
        text-align: left;
      }
      span:nth-child(2) {
        width: 300px;
        text-align: left;
      }
      span:nth-child(3) {
        width: 180px;
        text-align: left;
      }
      &.title {
        font-weight: bold;
        background: #052033;
        padding: 12px;
      }
      &.item {
        border-bottom: 1px solid #54cae4;
        padding: 0 12px;
      }
    }
  }
}
</style>
